{% set pypi_name = 'keystoneauth1' %}
{% set upstream_version = upstream_version('4.3.0') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}
Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack authenticating tools
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/keystoneauth
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('PyYAML') }}
BuildRequires:  {{ py3('betamax') }}
BuildRequires:  {{ py3('fixtures') }}
BuildRequires:  {{ py3('iso8601') }}
BuildRequires:  {{ py3('lxml') }}
BuildRequires:  {{ py3('mock') }}
BuildRequires:  {{ py3('oauthlib') }}
BuildRequires:  {{ py3('os-service-types') }}
BuildRequires:  {{ py3('oslo.config') }}
BuildRequires:  {{ py3('oslo.utils') }}
BuildRequires:  {{ py3('oslotest') }}
BuildRequires:  {{ py3('pbr') }}
BuildRequires:  {{ py3('requests-kerberos') }}
BuildRequires:  {{ py3('requests-mock') }}
BuildRequires:  {{ py3('stestr') }}
BuildRequires:  {{ py3('testresources') }}
BuildRequires:  {{ py3('testtools') }}
BuildArch:      noarch

%description
Tools for authenticating to an OpenStack-based cloud. These tools include:
* Authentication plugins (password, token, and federation based)
* Discovery mechanisms to determine API version support
* A session that is used to maintain client settings across requests
  (based on the requests Python library)

%package -n {{ py2name(py_versions='py3') }}
Summary:        OpenStack authenticating tools
Requires:       {{ py3('PyYAML') }}
Requires:       {{ py3('iso8601') }}
Requires:       {{ py3('lxml') }}
Requires:       {{ py3('oauthlib') }}
Requires:       {{ py3('os-service-types') }}
Requires:       {{ py3('requests') }}
Requires:       {{ py3('requests-kerberos') }}
Requires:       {{ py3('six') }}
Requires:       {{ py3('stevedore') }}

%description -n {{ py2name(py_versions='py3') }}
Tools for authenticating to an OpenStack-based cloud. These tools include:
* Authentication plugins (password, token, and federation based)
* Discovery mechanisms to determine API version support
* A session that is used to maintain client settings across requests
  (based on the requests Python library)

This package contains the Python 3.x module.

%package -n python-keystoneauth1-doc
Summary:        Documentation for OpenStack authenticating tools
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('openstackdocstheme') }}
BuildRequires:  {{ py3('sphinxcontrib-apidoc') }}

%description -n python-keystoneauth1-doc
Documentation for OpenStack authenticating tools.

%prep
%autosetup -p1 -n {{ pypi_name }}-%{version}
%py_req_cleanup

# cleanup intersphinx (we have no network during build)
echo "intersphinx_mapping = {}" >> doc/source/conf.py

%build
%{py3_build}

%install
%{py3_install}

# generate html docs
PBR_VERSION=%{version} %sphinx_build -b html doc/source doc/build/html
# remove the sphinx-build leftovers
rm -rf doc/build/html/.{doctrees,buildinfo}

%check
rm -v keystoneauth1/tests/unit/test_hacking_checks.py
python3 -m stestr.cli run

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc ChangeLog README.rst
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/*.egg-info

%files -n python-keystoneauth1-doc
%doc doc/build/html
%license LICENSE

%changelog
